home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / GUICtrlCreateEdit.au3 < prev    next >
Text File  |  2007-09-08  |  3KB  |  96 lines

  1. #include <GUIConstants.au3>
  2.  
  3. GUICreate("My GUI edit")  ; will create a dialog box that when displayed is centered
  4.  
  5. $myedit=GUICtrlCreateEdit ("First line"& @CRLF, 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL)
  6.  
  7. GUISetState ()
  8.  
  9. ; will be append dont' forget 3rd parameter
  10. GUICtrlSetData ($myedit, "Second line",1)
  11.  
  12. ; Run the GUI until the dialog is closed
  13. While 1
  14.     $msg = GUIGetMsg()
  15.     
  16.     If $msg = $GUI_EVENT_CLOSE Then ExitLoop
  17. Wend
  18.  
  19. ; Rich edit control EXAMPLE using GUICtrlCreateObj
  20.  
  21. ; Author: Kσre Johansson
  22. ; AutoIt Version: 3.1.1.55
  23. ; Description: Very Simple example: Embedding RICHTEXT object
  24. ; Needs: MSCOMCT2.OCX in system32 but it's probably already there
  25. ; Date: 3 jul 2005
  26.  
  27. #include <GUIConstants.au3>
  28. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
  29.  
  30. $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1")
  31.  
  32. GUICreate("Embedded RICHTEXT control Test", 320, 200, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_CLIPSIBLINGS,$WS_CLIPCHILDREN))
  33. $TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER)
  34. GuiCtrlSetFont($TagsPageC,9,400,4)
  35. GuiCtrlSetColor($TagsPageC,0x0000ff)
  36. GuiCtrlSetCursor($TagsPageC,0)
  37. $AboutC = GUICtrlCreateButton('About',105,177,70,20)
  38. $PrefsC = GUICtrlCreateButton('FontSize',175,177,70,20)
  39. $StatC = GUICtrlCreateButton('Plain Style',245,177,70,20)
  40.  
  41. $GUIActiveX = GUICtrlCreateObj( $oRP, 10, 10 , 400 , 260 )
  42. GUICtrlSetPos($GUIActiveX,10,10,300,160)
  43.  
  44. With $oRP; Object tag pool
  45. .OLEDrag()
  46. .Font = 'Arial'
  47. .text = "Hello - Au3 supports ActiveX components like the RICHTEXT thanks to SvenP" & @CRLF & 'Try write some text and quit to reload'
  48. ;.FileName = @ScriptDir & '\RichText.rtf'
  49. ;.BackColor = 0xff00
  50. EndWith
  51.  
  52. GUISetState ();Show GUI
  53.  
  54. While 1
  55.     $msg = GUIGetMsg()
  56.     
  57.     Select
  58.         Case $msg = $GUI_EVENT_CLOSE
  59.             $oRP.SaveFile( @ScriptDir & "\RichText.rtf", 0 )
  60.             ExitLoop
  61.         Case $msg = $TagsPageC
  62.             Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B7C8860-D78F-101B-B9B5-04021C009402}','', @SW_HIDE)
  63.         Case $msg = $AboutC
  64.             $oRP.AboutBox() 
  65.         Case $msg = $PrefsC
  66.             $oRP.SelFontSize = 12
  67.         Case $msg = $StatC
  68.             $oRP.SelBold = False
  69.             $oRP.SelItalic = False
  70.             $oRP.SelUnderline = False 
  71.             $oRP.SelFontSize = 8
  72.     EndSelect
  73. WEnd
  74.  
  75. Exit
  76.  
  77. Func MyErrFunc()
  78.  
  79.   Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"      & @CRLF  & @CRLF & _
  80.              "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
  81.              "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
  82.              "err.number is: "         & @TAB & hex($oMyError.number,8)  & @CRLF & _
  83.              "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
  84.              "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
  85.              "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
  86.              "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
  87.              "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
  88.             ,5)
  89.   ; Will automatically continue after 5 seconds
  90.             
  91.     Local $err = $oMyError.number
  92.     If $err = 0 Then $err = -1
  93.     
  94.     SetError($err)  ; to check for after this function returns
  95. Endfunc
  96.